﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DelonixRegiaHMSys.Core.Services;
using DelonixRegiaHMSys.Infrastructure.Data;
using DelonixRegiaHMSys.Core.Models;

namespace DelonixRegiaHMSys.UI.WebForms.HousekeepingandStaffModule
{
    public partial class Schedulling : System.Web.UI.Page
    {
        string userID;
        string roomNum;
        protected void Page_Load(object sender, EventArgs e)
        {
            var stservice = new stServices(new EfStaffQuery());
            userID = Request.QueryString["UserID"];
            roomNum = Request.QueryString["RoomNum"];
            lblroomNum.Text = roomNum;
            lblroomNum2.Text = roomNum;
            string a = "RM";
            DropDownListStaff.DataValueField = "staffID";
            DropDownListStaff.DataSource = stservice.RetrieveStaff(a).ToList();
            DropDownListStaff.DataBind();

        }

        protected void btnsave_Click(object sender, EventArgs e)
        {
            var hkservice = new hkServices(new EfHousekeepingQuery());
            HousekeepingReport hk = new HousekeepingReport();
            hk.ScheduleID = lblscheduleID.Text;
            hk.RoomNum = Convert.ToInt32(lblroomNum2.Text);
            hk.StaffID = DropDownListStaff.SelectedValue;
            hk.ScheduleDateTime = Convert.ToDateTime(Datetbx.Text);
            hkservice.AddSchedule(hk);
            Server.Transfer("~/WebForms/HousekeepingandStaffModule/Saved.aspx?UserID=" + userID);
        }
    }
}